<!-- 购物车详情弹窗 -->
<template>
            <a-form
                    ref="form3"
                    class="ele-form-detail"
                    :model="shoppingCartModalApp.shoppingCart"
                    :label-col="{md: {span: 2}, sm: {span: 4}, xs: {span: 6}}"
                    :wrapper-col="{md: {span: 22}, sm: {span: 20}, xs: {span: 18}}">
                <a-descriptions :title="shoppingCartModalApp.title" bordered>
                                    <a-descriptions-item label="标识">
                        {{ shoppingCartModalApp.shoppingCart.Eid }}
                    </a-descriptions-item>
                                    <a-descriptions-item label="创建人">
                        {{ shoppingCartModalApp.shoppingCart.creatorName }}
                    </a-descriptions-item>
                                    <a-descriptions-item label="名称">
                        {{ shoppingCartModalApp.shoppingCart.name }}
                    </a-descriptions-item>
                                    <a-descriptions-item label="商品">
                        {{ shoppingCartModalApp.shoppingCart.commodityId }}
                    </a-descriptions-item>
                                    <a-descriptions-item label="规格">
                        {{ shoppingCartModalApp.shoppingCart.specification }}
                    </a-descriptions-item>
                                    <a-descriptions-item label="附件">
                        {{ shoppingCartModalApp.shoppingCart.attachmentsId }}
                    </a-descriptions-item>
                                    <a-descriptions-item label="购买用户">
                        {{ shoppingCartModalApp.shoppingCart.userId }}
                    </a-descriptions-item>
                                    <a-descriptions-item label="数量">
                        {{ shoppingCartModalApp.shoppingCart.count }}
                    </a-descriptions-item>
                                    <a-descriptions-item label="状态">
                        {{ shoppingCartModalApp.shoppingCart.status }}
                    </a-descriptions-item>
                                    <a-descriptions-item label="创建人ID">
                        {{ shoppingCartModalApp.shoppingCart.creatorId }}
                    </a-descriptions-item>
                                    <a-descriptions-item label="备注">
                        {{ shoppingCartModalApp.shoppingCart.remark }}
                    </a-descriptions-item>
                                    <a-descriptions-item label="创建时间">
                        {{ shoppingCartModalApp.shoppingCart.createDatetime }}
                    </a-descriptions-item>
                                </a-descriptions>
            </a-form>
</template>

<script>
    import {defineComponent, reactive, onMounted, inject} from "vue";
    import {useRoute} from "vue-router"
    import {ShoppingCartService} from "@/views/mall/good/shoppingCart/shoppingCartService";

    export default defineComponent({
        setup() {
            const route = useRoute();
            let routeId = route.params.id;
            let shoppingCartListApp = inject('shoppingCartListApp', reactive({}));
            const shoppingCartModalApp = reactive({id: null, shoppingCart: {}, display: false});

            onMounted(() => {
                    shoppingCartModalApp.shoppingCart = {};
                if (routeId) {
                        shoppingCartModalApp.id = routeId;
                } else if (shoppingCartListApp.viewModalShowing) {
                        shoppingCartModalApp.id = shoppingCartListApp.currentId;
                        shoppingCartModalApp.display = true;
                }
                if (shoppingCartModalApp.id) {
                    getInfo(shoppingCartModalApp.id);
                }
            })

            const getInfo = (id) => {
                    ShoppingCartService.findShoppingCart(id).then((res) => {
                            shoppingCartModalApp.shoppingCart = res.data;
                            shoppingCartModalApp.title = "查看 " + shoppingCartModalApp.shoppingCart.name;
                })
            }

            return {
                    shoppingCartModalApp,
                routeId,
                getInfo,
            }
        }
    })
</script>

<style scoped>
</style>

